package org.paradise.dms.web.action.systemusergrouptaskallocation;

import java.util.List;

import net.sf.json.JSONArray;

import org.apache.log4j.Logger;
import org.directwebremoting.annotations.RemoteProxy;
import org.paradise.dms.pojo.SystemUser;
import org.paradise.dms.pojo.SystemUserGroup;
import org.paradise.dms.services.SystemUserGroupTaskAllocationService;
import org.paradise.dms.web.action.DMSBaseAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

@Service
@RemoteProxy(name = "dWRSystemUserAction")
public class DWRSystemUserAction extends DMSBaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = -8015853025059109975L;
	@SuppressWarnings("unused")
	private static Logger log = Logger.getLogger(DWRSystemUserAction.class);
	private List<SystemUser> systemUserList;
	private List<SystemUserGroup> systemUserGroupList;
	@Autowired
	@Qualifier("systemUserGroupTaskAllocationServiceImpl")
	SystemUserGroupTaskAllocationService systemUserGroupTaskAllocationService;

	public List<SystemUser> findUserByGroupid(int systemusergroupid) {
		return null;
	}

	public List<SystemUser> findAllUser() {
		return null;
	}

	public JSONArray findAllGroup(int value) {
		systemUserGroupList = systemUserGroupTaskAllocationService.listAllUserGroup(value);
		if (systemUserGroupList != null & systemUserGroupList.size() > 0) {
			JSONArray jsonArray = JSONArray.fromObject(systemUserGroupList);
			return jsonArray;
		}
		return null;
	}

	public JSONArray findAllUserBehindValue(int systemusergroupid, int systemusergroupvalue) {
		systemUserList = systemUserGroupTaskAllocationService.listAllUserBehindValue(systemusergroupid, systemusergroupvalue);
		if (systemUserList != null & systemUserList.size() > 0) {
			JSONArray jsonArray = JSONArray.fromObject(systemUserList);
			return jsonArray;
		}
		return null;
	}

	public JSONArray findUserByGroup(int systemusergroupid) {
		systemUserList = systemUserGroupTaskAllocationService.findUserByGroupid(systemusergroupid);
		if (systemUserList != null & systemUserList.size() > 0) {
			JSONArray jsonArray = JSONArray.fromObject(systemUserList);
			return jsonArray;
		}
		return null;
	}

}
